home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / tools / nwtp06 / nwserv.pas < prev    next >
Pascal/Delphi Source File  |  1996-07-10  |  23KB  |  748 lines

  1. {$X+,B-,V-} {essential compiler directives}
  2.  
  3. UNIT nwServ;
  4.  
  5. { nwServ unit as of 950301 / NwTP 0.6 API. (c) 1993,1995, R. Spronk }
  6.  
  7. INTERFACE
  8.  
  9. uses nwIntr,NwMisc,nwConn;
  10.  
  11. Var result:word;
  12.  
  13. { Primary Functions:                      Interrupt: Comments:
  14.  
  15. * CheckConsolePrivileges                  (F217/C8)
  16. * ClearConnectionNumber                   (F217/D2)
  17. * DisableFileServerLogin                  (F217/CB)
  18. . DisableTransactionTracking              (F217/CF)
  19. * DownFileServer                          (F217/D3)
  20. * EnableFileServerLogin                   (F217/CC)
  21. . EnableTransactionTracking               (F217/D0)
  22. * GetConnectionsOpenFiles                 (F217/EB)
  23.   GetConnectionsUsingAFile                (F217/EC)
  24. * GetDiskUtilization                      (F217/0E)
  25. * GetFileServerDateAndTime                (F214)
  26. * GetFileServerDescriptionStrings         (F217/C9)
  27. * GetFileServerLoginStatus                (F217/CD)
  28. * GetNetworkSerialNumber                  (F217/12)
  29. * GetFileServerInformation                (F217/11)
  30. * SetFileServerDateAndTime                (F217/CA)
  31. * VerifyNetworkSerialNumber               (F217/0C)
  32.  
  33.   Secondary functions:
  34.  
  35. * CheckNetwareVersion
  36.  
  37.   Not supported by netware 3.x: (2.x only)
  38.  
  39. - GetBinderyObjectDiskSpaceLeft           (F217/E6) (failed during testing)
  40. - GetConnectionsTaskInformation           (E3../DA)
  41. - GetConnectionsUsageStats                (E3../E5)
  42. - GetConnectionsUsingAFile                (E3../DC)
  43. - GetDiskCacheStats                       (E3../D6)
  44. - GetDiskChannelStats                     (E3../D9)
  45. - GetDriveMappingTable                    (E3../D7)
  46. - GetFileServerLANIOStats                 (E3../E7)
  47. - GetFileServerMiscInformation            (E3../E8)
  48. - GetFileSystemStats                      (E3../D4)
  49. - GetLANDriverConfigInfo                  (E3../E3)
  50. - GetLogicalRecordInformation             (E3../E0)
  51. - GetLogicalRecordsByConnection           (E3../DF)
  52. - GetPhysicalDiskStats                    (E3../D8)
  53. - GetPhysicalRecordLocksByFile            (E3../DE)
  54. - GetPhysRecLocksByConnectAndFile         (E3../DD)
  55. }
  56.  
  57.  
  58. Type TFileServerInformation
  59.                =Record
  60.                 ServerName         : string[48];
  61.                 NetwareVersion     : Byte;
  62.                 NetwareSubVersion  : Byte; { 0..99 }
  63.                 ConnectionsMax     : word;
  64.                 ConnectionsInUse   : word;
  65.                 MaxConnVol         : word; { max connected volumes }
  66.                 {---Advanced Netware 2.1x/3.x------------}
  67.                 OS_revision        : byte;
  68.                 SFT_level          : byte;
  69.                 TTS_level          : byte;
  70.                 peak_conn_used     : word; { max simult.used connections}
  71.                 accounting_version : byte;
  72.                 vap_version        : byte;
  73.                 queuing_version               : byte;
  74.                 print_server_version          : byte;
  75.                 virtual_console_version       : byte;
  76.                 security_restrictions_level   : byte;
  77.                 Internetwork_bridge_version   : byte;
  78.                 Undefined                     : Array [1..60] of Byte;
  79.                 End;
  80.  
  81. Type TfileInfoRecord=record
  82.                      TaskNbr      :Word;
  83.                      LockType     :Byte; { 00 no lock; FE file lock; FF locked by Begin Share File Set }
  84.                      AccessFlag   :Byte;
  85.                      LockFlag     :Byte;
  86.                      VolNbr       :Byte; { 0..31 }
  87.                      ParentEntryId:Longint;
  88.                      DirEntryId   :Longint;
  89.                      ForkCount    :Byte;
  90.                      NStype       :Byte;
  91.                      FileName     :String;
  92.                      end;
  93.      TfileInfoRecList=array[1..28] of TfileInfoRecord;
  94.  
  95. Type TfileUsageList=record
  96.                     UseCount         :word;
  97.                     OpenCount        :word;
  98.                     OpenForReadCount :word;
  99.                     OpenForWriteCount:word;
  100.                     DenyReadCount    :word;
  101.                     DenyWriteCount   :word;
  102.                     LockFlag         :Byte; { boolean }
  103.                     NStype           :Byte; { Fork Count = File siz? of NStype? }
  104.                     NbrOfRec         :word; { max 70 }
  105.                     FileUsage:array[1..70] of record
  106.                                               ConnNbr   :word;
  107.                                               TaskNbr   :word;
  108.                                               LockType  :byte;
  109.                                               AccessFlag:Byte;
  110.                                               LockFlag  :Byte;
  111.                                               end;
  112.                     end;
  113.  
  114. {F217/C8 [2.15c+]}
  115. FUNCTION CheckConsolePrivileges : Boolean;
  116.  
  117. {F217/D2 [2.15c+]}
  118. Function ClearConnectionNumber(connectionNbr:byte):boolean;
  119. { Console Rights needed;
  120.   -Terminates a connection. }
  121.  
  122. {F217/CB [2.15c+]}
  123. FUNCTION DisableFileServerLogin : Boolean;
  124.  
  125. {F217/CF [2.15c+]}
  126. FUNCTION DisableTransactionTracking : Boolean;
  127.  
  128. {F217/D3 [2.15c+]}
  129. FUNCTION DownFileServer (ForceFlag : Boolean) : Boolean;
  130.  
  131. {F217/CC [2.15c+]}
  132. FUNCTION EnableFileServerLogin : Boolean;
  133.  
  134. {F217/D0 [2.15c+]}
  135. FUNCTION EnableTransactionTracking : Boolean;
  136.  
  137.  
  138. {F217/EB [3.0+]}
  139. FUNCTION GetConnectionsOpenFiles
  140.            ( ConnNumber         : Byte;
  141.      {i/o:}  var LastRecordSeen : word;
  142.      {out:}  var NbrOfRecords   : word;
  143.              var FileInfo       : TfileInfoRecList ) : Boolean;
  144.  
  145. {F217/0E [2.15c+]}
  146. FUNCTION GetDiskUtilization(volNbr:byte; objID:Longint;
  147.                         Var usedDirs,usedFiles,usedBlocks:Word ):Boolean;
  148.  
  149. {F214    [2.15c+]}
  150. FUNCTION GetFileServerDateAndTime ( Var time:TnovTime): Boolean;
  151.  
  152. {F217/C9 [2.15c+]}
  153. FUNCTION GetFileServerDescriptionStrings(Var companyName,
  154.                                              VersionAndRevision,revisionDate,
  155.                                              copyrightNotice:String
  156.                                          ):Boolean;
  157.  
  158. {F217/CD [2.15c+]}
  159. FUNCTION GetFileServerLoginStatus (Var LoginEnabled:Boolean): Boolean;
  160. { if Login is enabled then returns TRUE in LoginEnabled }
  161.  
  162. {F217/12 [2.15c+]}
  163. Function GetNetworkSerialNumber(Var serialNbr:LongInt; Var ApplicNbr:Word ):Boolean;
  164. {return the serial number and application number for the software
  165.       installed on the file server}
  166.  
  167. {F217/11 [2.15c+]}
  168. Function GetFileServerInformation (Var serverInfo:TFileServerInformation):boolean;
  169. {determine the version of software installed on the file server and how it is configured}
  170.  
  171. {F217/CA [2.15c+]}
  172. FUNCTION SetFileServerDateAndTime(time:TnovTime):Boolean;
  173. {need console operator privileges to do this}
  174.  
  175. {F217/OC [2.15c+]}
  176. Function VerifyNetworkSerialNumber(serialNbr: LongInt ;
  177.                                Var ApplicNbr: Word     ):Boolean;
  178. {if the network serial number to be verified is correct, the reply
  179.       buffer will contain the corresponding application number }
  180.  
  181. {*********************** Secondary Functions ******************************}
  182.  
  183. { [1.x/2.x/3.x] }
  184. FUNCTION CheckNetwareVersion(MinimumVersion,MinimumSubVersion,
  185.                              MinimumRevision,MinimumSFT,MinimumTTS:word):Boolean;
  186.  
  187. IMPLEMENTATION{=============================================================}
  188.  
  189.  
  190. {F217/D2 [2.15c+]}
  191. Function ClearConnectionNumber(connectionNbr:byte):boolean;
  192. { Console Rights needed;
  193.   -Terminates a connection. }
  194. Type Treq=record
  195.           len : word;
  196.           subf: byte;
  197.           _connNbr:byte;
  198.           end;
  199.      TPreq=^Treq;
  200. begin
  201. With TPreq(GlobalReqBuf)^
  202. do begin
  203.    len:=2;
  204.    subf:=$D2;
  205.    _connNbr:=connectionNbr
  206.    end;
  207. F2SystemCall($17,SizeOf(Treq),0,result);
  208. ClearConnectionNumber:=(result=0);
  209. {result codes: 00 successful; C6 No Console Rights}
  210. end;
  211.  
  212. {F214 [2.15c+]}
  213. FUNCTION GetFileServerDateAndTime ( Var time:TnovTime): Boolean;
  214. Type Trep=TnovTime;
  215.      TPrep=^Trep;
  216. BEGIN
  217. F2SystemCall($14,0,SizeOf(Trep),result);
  218. Time:=TPrep(GlobalreplyBuf)^;
  219. if time.year>100
  220.  then time.year:=time.year-100;
  221. { year<80 : 21st century }
  222. result:=0;
  223. getFileServerDateAndTime:=TRUE;
  224. end;
  225.  
  226.  
  227. {F217/CA [2.15c+]}
  228. FUNCTION SetFileServerDateAndTime (time:TnovTime): Boolean;
  229. Type Treq=record
  230.           Len:word;
  231.           subF:byte;
  232.           _time:TnovTime
  233.           end;
  234.      TPreq=^Treq;
  235. BEGIN
  236. { year<80 : 21st century }
  237. WITH TPreq(GlobalReqBuf)^
  238. do begin
  239.    Len:=SizeOf(Treq)-3; { dow is not a parameter }
  240.    subF:=$CA;
  241.    _time:=time;
  242.    end;
  243. F2SystemCall($17,SizeOf(Treq),0,result);
  244. SetFileServerDateAndTime:=(Result=$00);
  245. { Resulcodes: $00 Success; $C6 No Console Operator Rights }
  246. end;
  247.  
  248.  
  249. {F217/11 [2.15c+]}
  250. Function GetFileServerInformation (Var serverInfo:TFileServerInformation):boolean;
  251. {determine the version of software installed on the file server and how it is configured}
  252.  
  253. {SeeAlso: GetDiskUtilization, GetNetworkSerialNumber, GetFileServerLoginStatus,
  254.           GetFileServerDateAndTime}
  255.  
  256. Type TReq=Record
  257.           Len  : word;
  258.           SubF : Byte;
  259.           End;
  260.      TRep=TFileServerInformation;
  261.      TPreq=^Treq;
  262.      TPrep=^Trep;
  263.  
  264. Var t:word;
  265. Begin
  266. With TPreq(GlobalReqBuf)^
  267. Do Begin
  268.    Len := 1;
  269.    SubF:= $11;
  270.    End;
  271. F2SystemCall($17,SizeOf(Treq),SizeOf(Trep)-1,result);
  272. Move(GlobalReplyBuf^[1],GlobalReplyBuf^[2],SizeOf(Trep)-1);
  273. serverInfo:=TPrep(GlobalReplyBuf)^;
  274. With serverinfo
  275. do begin
  276.    connectionsMax  :=Swap(connectionsMax);   { force lo-hi again }
  277.    ConnectionsInUse:=Swap(connectionsInUse);
  278.    MaxConnVol      :=Swap(maxConnVol);
  279.    peak_conn_used  :=Swap(peak_conn_used);
  280.    for t:=48 downto 1
  281.     do if serverInfo.serverName[t]=#0
  282.         then serverInfo.serverName[0]:=chr(t-1);
  283.    end;
  284. GetFileServerInformation:=(result=0);
  285. End;
  286.  
  287.  
  288.  
  289. {F217/C9 [2.15c+]}
  290. FUNCTION GetFileServerDescriptionStrings(Var companyName,
  291.                                              VersionAndRevision,revisionDate,
  292.                                              copyrightNotice:String
  293.                                          ):Boolean;
  294. {SeeAlso: GetFileServerLoginStatus, GetFileServerInformation. }
  295. Type Treq=record
  296.           len : word;
  297.           subf: byte;
  298.           end;
  299.      Trep=record
  300.           stuff : array [1..512] of byte;
  301.           end;
  302.      TPreq=^Treq;
  303.      TPrep=^Trep;
  304. Var x,xofs:word;
  305. begin
  306. With TPreq(GlobalReqBuf)^
  307. do begin
  308.    len  := 1;
  309.    subf := $c9;
  310.    end;
  311. F2SystemCall($17,SizeOf(Treq),SizeOf(Trep),result);
  312. companyName:=''; VersionAndRevision:='';
  313. revisionDate:=''; copyrightNotice:='';
  314. if result=$00
  315.  then with TPrep(GlobalReplyBuf)^
  316.       do begin
  317.          x:=1;xofs:=x;
  318.          while (stuff[x]<>$00) and (x<512) do inc(x);
  319.          ZStrCopy(companyName,stuff[xofs],x-xofs);
  320.  
  321.          inc(x);xofs:=x; { skip 1 zero. ? skip more zero's? }
  322.          While (stuff[x]<>$00) and (x<512) do inc(x);
  323.          ZStrCopy(VersionAndRevision,stuff[xofs],x-xofs);
  324.  
  325.          inc(x);xofs:=x;
  326.          While (stuff[x]<>$00) and (x<512) do inc(x);
  327.          ZStrCopy(revisionDate,stuff[xofs],x-xofs); { mm/dd/yy }
  328.  
  329.          inc(x);xofs:=x;
  330.          While (stuff[x]<>$00) and (x<512) do inc(x);
  331.          ZStrCopy(copyrightNotice,stuff[xofs],x-xofs);
  332.          end;
  333. GetFileServerDescriptionStrings:=(Result=$00);
  334. end;
  335.  
  336.  
  337.  
  338. {F217/D3 [2.15c+]}
  339. FUNCTION DownFileServer (ForceFlag : Boolean) : Boolean;
  340. Type Treq=record
  341.           len  : word;
  342.           subf : byte;
  343.           flag : byte;
  344.           end;
  345.      TPreq=^Treq;
  346. BEGIN
  347. With TPreq(GlobalReqBuf)^
  348. do begin
  349.    len  := 2;
  350.    subf := $D3;
  351.    if ForceFlag then flag := $FF { non-zero }
  352.                 else flag := $00;
  353.    end;
  354. F2SystemCall($17,SizeOf(Treq),0,result);
  355. DownFileServer:=(result=0);
  356. { resultcodes: 00=successful; C6 No Console Rights ; FF Open Files}
  357. end;
  358.  
  359.  
  360. {F217/CF [3.x]}
  361. FUNCTION DisableTransactionTracking : Boolean;
  362. { Caller must have console-operator rights. }
  363. Type Treq=record
  364.           len : word;
  365.           subf: byte
  366.           end;
  367.      TPreq=^Treq;
  368. BEGIN
  369. With TPreq(GlobalReqBuf)^
  370.  do begin
  371.     len := 1;
  372.     subf:= $CF;
  373.     end;
  374. F2SystemCall($17,SizeOf(Treq),0,result);
  375. DisableTransactionTracking:=(result=0);
  376. { resultcodes: 00=successful; C6 No Console Rights }
  377. end;
  378.  
  379.  
  380. {F217/D0 [3.x]}
  381. FUNCTION EnableTransactionTracking : Boolean;
  382. { Caller must have console-operator rights. }
  383. Type Treq=record
  384.           len : word;
  385.           subf: byte
  386.           end;
  387.      TPreq=^Treq;
  388. BEGIN
  389. With TPreq(GlobalReqBuf)^
  390.  do begin
  391.     len := 1;
  392.     subf:= $D0;
  393.     end;
  394. F2SystemCall($17,SizeOf(Treq),0,result);
  395. EnableTransactionTracking:=(result=0);
  396. { resultcodes: 00=successful; C6 No Console Rights }
  397. end;
  398.  
  399.  
  400. {F217/CB [2.15c+]}
  401. FUNCTION DisableFileServerLogin : Boolean;
  402. { Caller must have console-operator rights. }
  403. Type Treq=record
  404.           len : word;
  405.           subf: byte
  406.           end;
  407.      TPreq=^Treq;
  408. BEGIN
  409. With TPreq(GlobalReqBuf)^
  410.  do begin
  411.     len := 1;
  412.     subf:= $CB;
  413.     end;
  414. F2SystemCall($17,SizeOf(Treq),0,result);
  415. DisableFileServerLogin:=(result=0);
  416. { resultcodes: 00=successful; C6 No Console Rights }
  417. end;
  418.  
  419.  
  420.  
  421. {F217/CC [2.15c+]}
  422. FUNCTION EnableFileServerLogin : Boolean;
  423. { Caller needs console-operator rights. }
  424. Type Treq=record
  425.           len : word;
  426.           subf: byte
  427.           end;
  428.      TPreq=^Treq;
  429. BEGIN
  430. With TPreq(GlobalReqBuf)^
  431.  do begin
  432.     len := 1;
  433.     subf:= $CC;
  434.     end;
  435. F2SystemCall($17,SizeOf(Treq),0,result);
  436. EnableFileServerLogin:=(result=0);
  437. { resultcodes: 00=successful; C6 No Console Rights }
  438. end;
  439.  
  440.  
  441.  
  442. {F217/CD [2.15c+]}
  443. FUNCTION GetFileServerLoginStatus( Var LoginEnabled:Boolean ): Boolean;
  444. { if Login is enabled then returns TRUE in LoginEnabled }
  445. { result byte:  00h  - Success, C6h No Console Rights }
  446. { Caller must have operator status.}
  447. Type TReq=record
  448.           Len     : Word;
  449.           SubF    : Byte;
  450.           end;
  451.      TRep=record
  452.           Flag    : Byte;
  453.           end;
  454.      TPreq=^Treq;
  455.      TPrep=^Trep;
  456. begin
  457. with TPreq(GlobalReqBuf)^
  458.  do begin
  459.     Len     := 1;
  460.     SubF    := $CD;
  461.     end;
  462. F2SystemCall($17,SizeOf(Treq),SizeOf(Trep),result);
  463. LoginEnabled:=Boolean(TPrep(GlobalReplyBuf)^.Flag);
  464. GetFileServerLoginStatus := (result=0);
  465. end;
  466.  
  467.  
  468. {F217/C8 [2.15c+]}
  469. FUNCTION CheckConsolePrivileges : Boolean;
  470. Type TReq=record
  471.           Len  : Word;
  472.           SubF : Byte;
  473.           end;
  474.      TPreq=^Treq;
  475. begin
  476. with TPReq(GlobalReqBuf)^
  477.  do begin
  478.     Len  := 1;
  479.     SubF := $C8;
  480.     end;
  481. F2SystemCall($17,SizeOf(Treq),0,result);
  482. CheckConsolePrivileges := (Result=$00);
  483. { result byte:  00h  - Success, C6h No Console Rights }
  484. end;
  485.  
  486.  
  487. {F217/EB [3.0+]}
  488. FUNCTION GetConnectionsOpenFiles
  489.            ( ConnNumber         : Byte;
  490.      {i/o:}  var LastRecordSeen : word;
  491.      {out:}  var NbrOfRecords   : word;
  492.              var FileInfo       : TfileInfoRecList ) : Boolean;
  493.  
  494. { the calling workstation must have console operator privileges }
  495. { LastRecordSeen is an i/o parameter;
  496.   -An initial value of 0 has to be supplied;
  497.   -The function can be called until LastRecordSeen becomes 0,
  498.    indicating the end of the FIR-list.
  499.  
  500.   to be called iteratively. }
  501.  
  502. Type TReq=record
  503.           len           :word;
  504.           subf          :byte;
  505.           logicalConnNbr:word;
  506.           lastRecSeen   :word; {lo-hi, $0000 on first call }
  507.           end;
  508.      TRep=record
  509.           nextReqRec : word; { lo-hi, use as lastRecSeen in next iterative call }
  510.                              { $0000 if no more records }
  511.           RecCount   : word;
  512.           FIRbuf:array[1..508] of byte;
  513.           end;
  514.      TPreq=^Treq;
  515.      TPrep=^Trep;
  516. Var t,Foff:Word;
  517. begin
  518.  
  519. With TPreq(GlobalReqBuf)^
  520.  do begin
  521.     len:=sizeof(Treq)-2;
  522.     subf:=$EB;
  523.     logicalConnNbr:=connNumber;
  524.     lastRecSeen:=LastRecordSeen; { force hi-lo }
  525.     end;
  526. F2SystemCall($17,SizeOf(Treq),SizeOf(Trep),result);
  527. if result=$00
  528.  then with TPrep(GlobalReplyBuf)^
  529.       do begin
  530.          { Copy recCount FIRs from FIRbuf to the FileInfo[] array }
  531.          LastRecordSeen:=NextReqRec;
  532.          NbrOfrecords:=RecCount;
  533.          Foff:=0;
  534.          For t:=1 to RecCount
  535.           do begin
  536.              Move(FIRbuf[1+Foff],FileInfo[t],17+FIRbuf[Foff+17]);
  537.              inc(Foff,17+FIRbuf[Foff+17]);
  538.              { Direntry and ParentEntry may have to be swapped lo-hi }
  539.              end;
  540.          end
  541.  else begin
  542.       NbrOfRecords:=0;
  543.       LastRecordSeen:=0;
  544.       end;
  545. GetConnectionsOpenFiles:=(result=$00);
  546. { errorcodes: $00 Success; $C6 no console privileges }
  547. end;
  548.  
  549.  
  550. {F217/EC }
  551. Function GetConnectionsUsingAFile(VolNbr:Byte; EntryId:Longint; NStype:byte;
  552.                             {i/o} Var LastRecordSeen:word;
  553.                                   Var NbrOfRecords:Word;
  554.                                   Var FileInfo:TfileUsageList):boolean;
  555. { This call returns all connection numbers using the file specified
  556.   by the Volume Number and Directory Entry Id. }
  557.  
  558. { !! UNDER CONSTRUCTION !! }
  559.  
  560. Type TReq=record
  561.           len        :word;
  562.           subf       :byte;
  563.           NStype     :Byte;  {= data stream type / Fork type }
  564.           VolNbr     :Byte;
  565.           DirEntryId :Longint;
  566.           LastRecSeen:Word;   {initially set to 0}
  567.           end;
  568.  
  569.      TRep=record
  570.           NextRec          :word; { iteration }
  571.  
  572.           UseCount         :word;
  573.           OpenCount        :word;
  574.           OpenForReadCount :word;
  575.           OpenForWriteCount:word;
  576.           DenyReadCount    :word;
  577.           DenyWriteCount   :word;
  578.           LockFlag         :Byte; { boolean }
  579.           NStype           :Byte; { Fork Count -> ?? NStype }
  580.           NbrOfRec         :word; { max 70 }
  581.           FileUsage:array[1..70] of record
  582.                                     ConnNbr   :word;
  583.                                     TaskNbr   :word;
  584.                                     LockType  :byte;
  585.                                     AccessFlag:Byte;
  586.                                     LockFlag  :Byte;
  587.                                     end;
  588.           end;
  589.      TPreq=^Treq;
  590.      TPrep=^Trep;
  591. begin
  592. With TPreq(GlobalReqBuf)^
  593.  do begin
  594.     len:=sizeof(Treq)-2;
  595.     subf:=$EC;
  596.  
  597.     end;
  598. F2SystemCall($17,SizeOf(Treq),SizeOf(Trep),result);
  599. if result=$00
  600.  then with TPrep(GlobalReplyBuf)^
  601.       do begin
  602.  
  603.          end
  604.  else begin
  605.       NbrOfRecords:=0;
  606.       LastRecordSeen:=0;
  607.       end;
  608. GetConnectionsUsingAFile:=(result=$00);
  609. { errorcodes: $00 Success; $C6 no console privileges }
  610. end;
  611.  
  612.  
  613. {F217/0E [2.15c+]}
  614. FUNCTION GetDiskUtilization(volNbr:byte; objID:Longint;
  615.                         Var usedDirs,usedFiles,usedBlocks:Word ):Boolean;
  616. { SeeAlso: GetFileServerInformation,getBinderyObjectDiskSpaceLeft }
  617. Type TReq=record
  618.           Len  : Word;
  619.           SubF : Byte;
  620.           _volNbr:Byte;
  621.           _objID:longInt; { hi-lo }
  622.           end;
  623.      TRep=record
  624.           _volNbr:Byte;
  625.           _objID:Longint; {hi-lo}
  626.           _usedDirs,
  627.           _usedFiles,
  628.           _usedBlocks:Word; { all hi-lo }
  629.           end;
  630.     TPreq=^Treq;
  631.     TPrep=^Trep;
  632. begin
  633. with TPReq(GlobalReqBuf)^
  634.  do begin
  635.     Len  := SizeOf(TReq)-2;
  636.     SubF := $0E;
  637.     _volNbr:=volNbr;
  638.     _objID:=Lswap(objID);
  639.     end;
  640. F2SystemCall($17,SizeOf(Treq),SizeOf(Trep),result);
  641. if result=$00
  642. then begin
  643.      with TPrep(GlobalReplyBuf)^
  644.      do begin
  645.         usedDirs:=swap(_usedDirs);    { force lo-hi }
  646.         usedFiles:=swap(_usedFiles);  { force lo-hi }
  647.         usedBlocks:=swap(_usedBlocks);{ force lo-hi }
  648.         end;
  649.      end;
  650. GetDiskUtilization:=(result=$00);
  651. {Resultcodes: 00h successful; 98h volume doesn't exist
  652.               89h No Search Privileges
  653.              F2h no Object read privileges }
  654. end;
  655.  
  656.  
  657. {F217/12 [2.15c+]}
  658. Function GetNetworkSerialNumber(Var serialNbr:LongInt; Var ApplicNbr:Word ):Boolean;
  659. {return the serial number and application number for the software
  660.       installed on the file server}
  661. {SeeAlso: VerifyNetworkSerialNumber,GetFileServerInformation}
  662. Type TReq=record
  663.           Len     : Word;
  664.           SubF    : Byte;
  665.           end;
  666.      TRep=record
  667.           _serNbr   : LongInt; {hi-lo}
  668.           _applicNbr: Word;    {hi-lo}
  669.           end;
  670.      TPreq=^Treq;
  671.      TPrep=^Trep;
  672. begin
  673. with TPreq(GlobalReqBuf)^
  674.  do begin
  675.     Len     := 1;
  676.     SubF    := $12;
  677.     end;
  678. F2SystemCall($17,SizeOf(Treq),SizeOf(Trep),result);
  679. with TPrep(GlobalReplyBuf)^
  680.  do begin
  681.     ApplicNbr:=swap(_applicNbr);   { force lo-hi }
  682.     serialNbr:=Lswap(_serNbr);     { force lo-hi }
  683.     end;
  684. GetNetworkSerialNumber := (result=0);
  685. end;
  686.  
  687.  
  688.  
  689. {F217/OC [2.15c+]}
  690. Function VerifyNetworkSerialNumber(serialNbr: LongInt ;
  691.                                Var ApplicNbr: Word     ):Boolean;
  692. {if the network serial number to be verified is correct, the reply
  693.       buffer will contain the corresponding application number }
  694. {SeeAlso: GetNetworkSerialNumber}
  695. Type Treq=record
  696.           Len        : Word;
  697.           SubF       : Byte;
  698.           _netwSerNbr: LongInt; {hi-lo}
  699.           end;
  700.      TRep=record
  701.           _applicNbr: word; {hi-lo}
  702.           end;
  703.      TPreq=^Treq;
  704.      TPrep=^Trep;
  705. begin
  706. with TPReq(GlobalReqBuf)^
  707.  do begin
  708.     Len     := 1;
  709.     SubF    := $0C;
  710.     _netwSerNbr:=Lswap(serialNbr);
  711.     end;
  712. F2SystemCall($17,SizeOf(Treq),SizeOf(Trep),result);
  713. with TPrep(GlobalReplyBuf)^
  714. do begin
  715.    ApplicNbr:=swap(_applicNbr); { force lo-hi }
  716.    end;
  717. VerifyNetworkSerialNumber := (result=0);
  718. end;
  719.  
  720. {****************** secondary functions ************************************}
  721.  
  722.  
  723. FUNCTION CheckNetwareVersion(MinimumVersion,MinimumSubVersion,
  724.                              MinimumRevision,MinimumSFT,MinimumTTS:word):Boolean;
  725. { checks if the current OS/TTS/SFT version is greater or equal to the minimal version }
  726. Var info:TFileServerInformation;
  727.     res:boolean;
  728. begin
  729. IF GetFileServerInformation(info)
  730. then begin
  731.      IF (info.NetwareVersion>MinimumVersion)
  732.        then res:=true
  733.        else if (info.NetwareVersion=MinimumVersion)
  734.                AND (info.NetwareSubVersion>MinimumSubVersion)
  735.             then res:=true
  736.             else if (info.NetwareVersion=MinimumVersion)
  737.                     AND (info.NetwareSubVersion=MinimumSubVersion)
  738.                     AND (info.OS_Revision>=MinimumRevision)
  739.                  then res:=true
  740.                  else res:=false
  741.      end
  742. else res:=false;
  743.  
  744. CheckNetwareVersion:=res AND (info.SFT_Level>=MinimumSFT)
  745.                          AND (info.TTS_Level>=MinimumTTS)
  746. end;
  747.  
  748. end. {unit nwServ}